package com.siriuscloud.holidayreservation.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.siriuscloud.holidayreservation.domain.AppointNumber;
import com.siriuscloud.holidayreservation.domain.Holiday;
import com.siriuscloud.holidayreservation.mapper.AppointNumberMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class AppointNumberService {

    @Resource
    private AppointNumberMapper appointNumberMapper;

    public List<AppointNumber> getAllHoliday(Date startDate, Date endDate, String departmentId) {
        QueryWrapper<AppointNumber> queryWrapper = new QueryWrapper<>();
        if (startDate != null) {
            queryWrapper.ge("date", startDate.getTime());
        }
        if (endDate != null) {
            queryWrapper.le("date", endDate.getTime());
        }
        if (null != departmentId) {
            queryWrapper.eq("department_id", departmentId);
        }
        return appointNumberMapper.selectList(queryWrapper);
    }
}
